package com.dzm.xgb.core.controller.api;


import com.dzm.common.result.R;
import com.dzm.common.util.JwtUtils;
import com.dzm.xgb.core.pojo.entity.LendItemReturn;
import com.dzm.xgb.core.service.LendItemReturnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 标的出借回款记录表 前端控制器
 * </p>
 *
 * @author Dzm
 * @since 2024-08-27
 */
@RestController
@RequestMapping("/api/core/lendItemReturn")
public class LendItemReturnController {

    @Autowired
    private LendItemReturnService lendItemReturnService;

    @GetMapping("/auth/list/{id}")
    public R list(@PathVariable("id")Long id, @RequestHeader("token") String token) {
        Long userId = JwtUtils.getUserId(token);
        List<LendItemReturn> list = lendItemReturnService.getListByLendId(id,userId);

        return R.ok().data("list", list);
    }
}

